package com.atwl.school_system.service.serviceImpl;

import com.atwl.school_system.bean.Address;
import com.atwl.school_system.mapping.AddressDao;
import com.atwl.school_system.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressDao addressDao;

    @Override
    public void addAddress(Address address) {
        Address addressData = addressDao.getAddressById(address.getId());
        if (addressData != null) {
            addressDao.updateAddress(address);
        } else {
            addressDao.addAddress(address);
        }
    }
}
